//
// 作者：AKA_GGbond
// 时间：2025/7/18
// 邮箱：evain_wl@163.com
// 描述：阴影、圆角、可拉伸的窗口
//

#ifndef ESMU_W_RADIUSFORM_H
#define ESMU_W_RADIUSFORM_H

#include <QWidget>

class W_RadiusForm : public QWidget
{
    Q_OBJECT

public:
    explicit W_RadiusForm(QWidget *parent = nullptr);
    ~W_RadiusForm();

public:
    void SetCentralWidgetLayout(QLayout *layout);

protected:
    void mouseMoveEvent(QMouseEvent *event)override;
    void mousePressEvent(QMouseEvent *event)override;
    void mouseReleaseEvent(QMouseEvent *event)override;
    void paintEvent(QPaintEvent *event) override;

private:
    void setLayout(QLayout * layout);
    void updatePaddingRect();

private:
    QWidget * widget;
    enum class pressType
    {
        NoPressed,                 //未按下
        PressedRight,              //鼠标按下右侧
        PressedBottom,             //鼠标按下下侧
        PressedRightBottom,        //鼠标按下右下侧
        PressedButNotInPadding     //按下但没在右、下、右下边缘
    };
    pressType mousePressType{pressType::NoPressed};
    int padding;                    //边距
    bool moveEnable{false};         //可移动
    bool resizeEnable{false};        //可拉伸

    int rectX, rectY, rectW, rectH; //窗体坐标+宽高
    QPoint lastPos;

    QRect rectRight;
    QRect rectBottom;
    QRect rectRightBottom;
};


#endif //ESMU_W_RADIUSFORM_H
